﻿Imports System.Data
Imports System.Data.SqlClient
Imports System.ComponentModel
Imports System.Web
Imports System.Web.UI
Imports System.Web.UI.WebControls
Imports System.Web.UI.HtmlControls
Imports System.Drawing
Imports System.Collections



Public Class test
    Inherits System.Web.UI.Page

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        Dim str As String = Request.QueryString("btnHidden")
        Response.Write(str)
        'If Not Page.IsPostBack Then
        '    BindGrid()
        'End If
    End Sub
    Private Sub BindGrid()
        Dim strConn As String = "Data Source=Cuong-Desktop;Initial Catalog=ORS;Persist Security Info=True;User ID=SA;Password=@bc2310"
        Dim conn As SqlConnection = New SqlConnection(strConn)
        conn.Open()
        Dim strSQL As String = "Select * From [User]"
        Dim cmd As SqlCommand = New SqlCommand()
        cmd.CommandText = strSQL
        cmd.Connection = conn
        Dim dtReader As SqlDataReader = cmd.ExecuteReader(CommandBehavior.CloseConnection)
        Datagrid1.DataSource = dtReader
        Datagrid1.DataBind()

    End Sub
    'Public Function GetValues(ByVal TableName As String) As System.Data.SqlClient.SqlDataReader
    '    Dim strConn As String = "Data Source=Cuong-Desktop;Initial Catalog=ORS;Persist Security Info=True;User ID=SA;Password=@bc2310"
    '    Dim conn As SqlConnection = New SqlConnection(strConn)
    '    conn.Open()

    'End Function
    Public Sub OnEdit(ByVal source As Object, ByVal e As DataGridCommandEventArgs)
        Datagrid1.EditItemIndex = e.Item.ItemIndex
        BindGrid()

    End Sub
    Public Sub OnCancel(ByVal source As Object, ByVal e As DataGridCommandEventArgs)
        Datagrid1.EditItemIndex = -1
        BindGrid()
    End Sub

End Class